﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" 
CodeBehind="TournamentGroup.aspx.cs" Inherits="Nivdal.TournamentGroup" Theme="SkinFile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="server" >
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="basic_element">
    <div class="red_title">
       <asp:HyperLink ID="PageTitleLink" runat="server" CssClass="white_title"></asp:HyperLink>
    </div>
    <div class="padding5">
        <asp:HiddenField ID="GroupIdHiddenField" runat="server" />
        <asp:HiddenField ID="NationalTeamsHiddenField" runat="server" />
        <asp:GridView ID="GroupTableGrid" runat="server" AutoGenerateColumns="false" SkinID="Professional" DataSourceID="TableDataSource">
        <Columns>
            <asp:TemplateField ItemStyle-Width="10%">
                <ItemTemplate>
                    <asp:Label ID="N" runat="server" Text='<%# Eval("Position")%>' SkinID="GridLabel"> </asp:Label> 
                    <asp:Image ID="GreenArrowImage" runat="server" ImageUrl="~/Images/Icons/arrowup.png" Visible='<%# Eval("Promotes") %>' />                    
                </ItemTemplate>
            </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="50%">
                <HeaderTemplate>
                    <asp:Label ID="TeamNameLabel" ToolTip="<%$ Resources:Resource, league_TeamNameLabelToolTip %>" runat="server" Text="<%$ Resources:Resource, Global_TeamName %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="TeamLink" runat="server" Text='<%# Eval("TeamName") %>' SkinID="BlackHyperLinkSkin"
                        NavigateUrl='<%# (IsNationalTeams() ? "~/NationalTeam.aspx?Id=" : "~/TeamHomePage.aspx?TeamId=") + Eval("TeamId") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="10%">
                <HeaderTemplate>
                    <asp:Label ID="GamesTitleLabel" ToolTip="<%$ Resources:Resource, Global_Games %>" runat="server" Text="<%$ Resources:Resource, Global_GamesHeader %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="GamesLabel" runat="server" Text='<%# Eval("Round")%>' SkinID="GridLabel"> </asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="10%">
                <HeaderTemplate>
                    <asp:Label ID="PointLabel" ToolTip="<%$ Resources:Resource, Global_Points %>" runat="server" Text="<%$ Resources:Resource, league_PointLabel %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Points")%>' SkinID="GridLabel"> </asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="20%">
                <HeaderTemplate>
                    <asp:Label ID="GoalsLabel" ToolTip="<%$ Resources:Resource, Global_Goals %>" runat="server" Text="<%$ Resources:Resource, Global_GoalsHeader %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" SkinID="GridLabel"
                        Text='<%# Eval("GoalsScored").ToString() + " - " + Eval("GoalsAgainst").ToString() %>' ></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        </asp:GridView>
    </div>
    </div>
    <asp:Repeater ID="RoundsRepeater" runat="server" DataSourceID="RoundsDataSource">
        <ItemTemplate>
        <div class="basic_element">
        <div class="red_title">
            <asp:Label ID="RoundNameLabel" runat="server" CssClass="white_title" Text='<%# Resources.Resource.Global_Round + " " + Eval("RoundNumber") %>'></asp:Label>
            <asp:Label ID="DateLabel" runat="server" CssClass="white_title" Text='<%# Eval("Date") %>'></asp:Label>
            
        </div>
        <div class="padding5">
            <asp:HiddenField ID="RoundNumHiddenfield" runat="server" Value='<%# Eval("RoundNumber") %>' />
            
            <asp:GridView ID="RoundMatchesGridview" runat="server" AutoGenerateColumns="false" DataSourceID="RoundMatchesDataSource"
             SkinID="Professional">
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:HyperLink NavigateUrl='<%# "~/MatchPage.aspx?MatchId=" + Eval("MatchId") %>'  
                            Text='<%# Eval("MatchTitle") %>' ID="Matchlink" runat="server" SkinId="BlackHyperLinkSkin" ></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="ResultLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("Result") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>            
            <asp:SqlDataSource ID="RoundMatchesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                SelectCommand="Nivdal_GetTournamentStageRoundMatches" SelectCommandType="StoredProcedure">
                <SelectParameters>
                    <asp:ControlParameter ControlID="GroupIdHiddenField" PropertyName="Value" Name="GroupId" />
                    <asp:ControlParameter ControlID="RoundNumHiddenfield" PropertyName="Value" Name="Round" />
                </SelectParameters>
            </asp:SqlDataSource>
            </div>
            </div>
        </ItemTemplate>
    </asp:Repeater>
    
    <asp:SqlDataSource ID="TableDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_GetTournamentStageGroupTable" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="RoundsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_GetTournamentGroupRounds" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>
